package com.sunjob.mroresumeproject.service;

import com.sunjob.common.domain.mroresume.CKParts;
import com.sunjob.common.domain.mroresume.RPParts;
import com.sunjob.common.util.MROUtils;
import com.sunjob.mroresumeproject.dao.CKPartsMapper;
import com.sunjob.mroresumeproject.dao.RPPartsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class RPPartsServiceImpl implements RPPartsService{
    @Autowired
    RPPartsMapper rpPartsMapper;


    @Override
    public int querycount() {
        return rpPartsMapper.querycount();
    }

    @Override
    public List<RPParts> queryRPparts(int pages, int size) {
        return rpPartsMapper.queryRPparts(pages,size);
    }

    @Override
    public List<RPParts> queryRPparts2(String repairid) {

            return rpPartsMapper.queryCKparts2(repairid);

    }

    @Override
    public void insertRPparts(RPParts rpParts) {
    rpParts.setRepairid(MROUtils.nextId());
    rpParts.setStarttime(LocalDateTime.now());
    rpParts.setEndtime(LocalDateTime.now());
    rpParts.setStatues(1);
     rpPartsMapper.insertRPparts();
    }

    @Override
    public List<RPParts> queryRPparts5() {
        return rpPartsMapper.queryRPparts5();
    }

    @Override
    public List<RPParts> queryRPpartsone(Long repairid) {
        return rpPartsMapper.queryRPpartsone(repairid);
    }

    @Override
    public void updateRPparts(String repairid, String RPcontent, String partstypes, String management, String partsinitial, String partsend, String failreason, String money, String starttime, String endtime) {
        rpPartsMapper.updateRPparts(repairid,RPcontent,partstypes,management,partsinitial,partsend,failreason,money,starttime,endtime);
    }

    @Override
    public void deleteRPparts(String repairid) {
     rpPartsMapper.deleteRPparts(repairid);
    }

    @Override
    public void deleteRPpartsone(String s) {
        rpPartsMapper.deleteRPpartsone(s);
    }
}

